"use strict";
const common_vendor = require("../../../common/vendor.js");
const common_assets = require("../../../common/assets.js");
const api_workGuide_index = require("../../../api/workGuide/index.js");
if (!Array) {
  const _easycom_up_gap2 = common_vendor.resolveComponent("up-gap");
  const _easycom_up_toast2 = common_vendor.resolveComponent("up-toast");
  (_easycom_up_gap2 + _easycom_up_toast2)();
}
const _easycom_up_gap = () => "../../../node-modules/uview-plus/components/u-gap/u-gap.js";
const _easycom_up_toast = () => "../../../node-modules/uview-plus/components/u-toast/u-toast.js";
if (!Math) {
  (_easycom_up_gap + _easycom_up_toast)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "detail",
  setup(__props) {
    const uToastRef = common_vendor.ref(null);
    const detailInfo = common_vendor.ref({});
    common_vendor.onLoad((options) => {
      if (options && options.id) {
        getWordGuideDetail(options.id);
      }
    });
    const getWordGuideDetail = (id) => {
      api_workGuide_index.detailWorkGuide({ id, type: "crowd" }).then((res) => {
        const { data } = res;
        detailInfo.value = data;
      }).catch((err) => {
        uToastRef.value.show({
          type: "error",
          message: err
        });
      });
    };
    const onTransact = () => {
      if (detailInfo.value.processingAddress) {
        api_workGuide_index.workGuideAddView({ id: detailInfo.value.id }).then((res) => {
        }).catch((err) => {
          uToastRef.value.show({
            type: "error",
            message: err
          });
        });
        common_vendor.index.navigateTo({
          url: `/subPages/crowd/publicAccount/ykb?url=${detailInfo.value.processingAddress}`
        });
      } else {
        uToastRef.value.show({
          type: "warning",
          message: "请联系管理员配置业务办理地址！"
        });
      }
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.t(common_vendor.unref(detailInfo).itemName),
        b: common_vendor.o(onTransact),
        c: common_vendor.unref(common_assets.flowIcon),
        d: common_vendor.unref(detailInfo).content,
        e: common_vendor.p({
          height: "16"
        }),
        f: common_vendor.sr(uToastRef, "273faf40-1", {
          "k": "uToastRef"
        })
      };
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-273faf40"]]);
wx.createPage(MiniProgramPage);
